define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'user/index',
        add_url: 'user/add',
        edit_url: 'user/edit',
        delete_url: 'user/delete',
        export_url: 'user/export',
        modify_url: 'user/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},                    {field: 'id', title: 'id'},                    {field: 'pid', title: '父ID'},                    {field: 'nickname', title: '昵称'},                    {field: 'head', title: '头像 从小程序获取'},                    {field: 'mobile', title: '手机号'},                    {field: 'email', title: 'email'},                    {field: 'money', title: '用户金额'},                    {field: 'total_amount', title: '消费累计'},                    {field: 'reg_time', title: '注册时间'},                    {field: 'openid', title: '微信验证后返回openid'},                    {field: 'token', title: 'token'},                    {field: 'token_time', title: 'token_time'},                    {field: 'money_frozen', title: '冻结佣&金'},                    {field: 'money_cash', title: '可提佣&金'},                    {field: 'money_cashed', title: '已提佣&金'},                    {field: 'first_member', title: '一级会员'},                    {field: 'second_member', title: '二级会员'},                    {field: 'third_member', title: '三级会员'},                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});